<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('充值记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" id="userId" name="userId" th:value="${userId}">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <label>充值/交费时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPayTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPayTime]"/>
                            </li>
                            <li>
                                <label>充值/交费状态：</label>
                                <select name="status" th:with="type=${@dict.getType('recharge_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>类型：</label>
                                <select name="type" th:with="type=${@dict.getType('pay_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="water:pay:edit">
                    <i class="fa fa-plus"></i> 我要充值
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('water:pay:edit')}]];
        var removeFlag = [[${@permission.hasPermi('water:pay:remove')}]];
        var statusDatas = [[${@dict.getType('recharge_status')}]];
        var typeDatas = [[${@dict.getType('pay_type')}]];
        var prefix = ctx + "water/pay";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/edit",
                modalName: "我要充值",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id', 
                    title: 'null',
                    visible: false
                },
                {
                    field: 'userId', 
                    title: '用户id',
                    visible: false
                },
                {
                    field: 'usageId', 
                    title: '用水表id',
                    visible: false
                },
                {
                    field: 'amount', 
                    title: '充值/交费金额',
                    align: 'center'
                },
                {
                    field: 'payTime', 
                    title: '充值/交费时间',
                    align: 'center'
                },
                {
                    field: 'status', 
                    title: '充值/交费状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'type', 
                    title: '类型',
                    align: 'center',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(typeDatas, value);
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>